/*************************************************************************
    > File Name: fileBaseName
    > Author: Lancer
    > Mail: 18826075768@163.com
************************************************************************/

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <event.h>
#include <time.h>

using namespace std;

struct event ev;
struct timeval tv;

void timer_cb(int fd, short event, void* arg){
    printf("timer cb\n");
    event_add(&ev, &tv);
}

int main(){
    struct event_base* base = event_init();
    tv.tv_sec = 1;
    tv.tv_usec = 0;

    event_set(&ev, -1, 0, timer_cb, NULL);
    event_base_set(base, &ev);
    event_add(&ev, &tv);
    event_base_dispatch(base);
    
    return 0;
}